package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.NoteDTO;
import com.tianji.learning.domain.query.AdminNoteQuery;
import com.tianji.learning.domain.query.NoteQuery;
import com.tianji.learning.domain.vo.AdminNotePageVO;
import com.tianji.learning.domain.vo.NoteDetailVO;
import com.tianji.learning.domain.vo.NotePageVO;
import com.tianji.learning.service.INoteService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 笔记记录表 前端控制器
 * </p>
 *
 * @author hrz
 * @since 2025-09-04
 */
@RestController
@RequestMapping("/admin/notes")
@RequiredArgsConstructor
public class NoteAdminController {
    private final INoteService noteService;

    @GetMapping("/page")
    @ApiOperation("管理端分页查询笔记")
    public PageDTO<AdminNotePageVO> getAdminNotePage(@RequestBody AdminNoteQuery query) {
        return noteService.getAdminNotePage(query);
    }

    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("隐藏或显示笔记")
    public void hiddenNote(@PathVariable Long id, @PathVariable Boolean hidden) {
        noteService.hiddenNote(id, hidden);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据id查询笔记详情")
    public NoteDetailVO getNote(@PathVariable Long id) {
        return noteService.getNoteDetail(id);
    }
}
